//
//  MQMusicPlayView.m
//  MQ
//
//  Created by lanou on 15/10/28.
//  Copyright © 2015年 徐永祥. All rights reserved.
//

#import "MQMusicPlayView.h"
#import <UIImageView+WebCache.h>
@implementation MQMusicPlayView
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
//        self.backgroundColor = [UIColor whiteColor];
       
//        _backImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 200)];
//        _backImageView.image = [UIImage imageNamed:@"yinyueBeijing.jpg"];
//        _backImageView.alpha = 0.3;
//        [self addSubview:_backImageView];
        
        _singerImageView = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 2 - 75, 20, 150, 150)];
        _singerImageView.userInteractionEnabled = YES;
//        _singerImageView.backgroundColor = [UIColor lightGrayColor];
        _singerImageView.layer.cornerRadius = 75;
        _singerImageView.layer.masksToBounds = YES;
        [self addSubview:_singerImageView];
        
//        _musicNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 2 - 50, 135 , SCREEN_WIDTH / 2, 30)];
//        [self addSubview:_musicNameLabel];
        
        _slider = [[UISlider alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 2 - 90, 175, 150, 30)];
        [_slider setThumbImage:[UIImage imageNamed:@"iconfont-shuxian"] forState:(UIControlStateNormal)];
        [self addSubview:_slider];
        
        _timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 2 + 60, 175, 50, 30)];
        [self addSubview:_timeLabel];
        
        _beforeBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _beforeBtn.frame = CGRectMake(SCREEN_WIDTH / 2 - 115, 210, 30, 30);
        [_beforeBtn setImage:[UIImage imageNamed:@"shangyiqu"] forState:(UIControlStateNormal)];
        [self addSubview:_beforeBtn];
        
        _pauseAndPlayBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _pauseAndPlayBtn.frame = CGRectMake(SCREEN_WIDTH / 2 - 15, 210, 30, 30);
        [_pauseAndPlayBtn setImage:[UIImage imageNamed:@"zanting"] forState:(UIControlStateNormal)];
        _pauseAndPlayBtn.selected = YES;
        [self addSubview:_pauseAndPlayBtn];
        
        _nextBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _nextBtn.frame = CGRectMake(SCREEN_WIDTH / 2 + 85, 210, 30, 30);
        [_nextBtn setImage:[UIImage imageNamed:@"xiayiqu"] forState:(UIControlStateNormal)];
        [self addSubview:_nextBtn];
        
    }
    return self;
}
- (void)configureViewWithModel:(MQMusicDetailModel *)model{
    [_singerImageView sd_setImageWithURL:[NSURL URLWithString:model.singer_pic_url]];
//    _musicNameLabel.text = model.song_name;
    _timeLabel.text = [NSString stringWithFormat:@"00:00"];
    self.musicListVC.navigationItem.title = model.song_name;
    
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
